package com.imonsoft.sqm.service.business.ipic_system;


import com.imonsoft.sqm.dao.business.ipic_system.ClaimIncomingViewDAO;
import com.imonsoft.sqm.pojo.business.ipic_system.ClaimIncomingView;
import com.imonsoft.sqm.pojo.business.ipic_system.ClaimIncomingViewExample;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;


@Service("claimIncomingViewService")
public class ClaimIncomingViewServiceImpl implements ClaimIncomingViewService {
	protected final Log logger = LogFactory.getLog(getClass());
    @Autowired
    private ClaimIncomingViewDAO claimIncomingViewDAO;


    public List<ClaimIncomingView> findClaimIncomingView(Map<String, Object> searchMap){
        ClaimIncomingViewExample example = new ClaimIncomingViewExample();
        ClaimIncomingViewExample.Criteria criteria = example.createCriteria();
        if(null!=searchMap){
            if(null!=searchMap.get("year")){
                criteria.andYearEqualTo(Integer.parseInt((String)searchMap.get("year")));
            }
            if(null!=searchMap.get("month")){
                //criteria.andMonthLessThanOrEqualTo(Integer.parseInt((String)searchMap.get("month")));
                criteria.andMonthEqualTo(Integer.parseInt((String)searchMap.get("month")));
            }
            if(null!=searchMap.get("type")){
                criteria.andTypeEqualTo((String)searchMap.get("type"));
            }
        }
        List<ClaimIncomingView> claimIncomingViewList=claimIncomingViewDAO.selectClaimIncomingViewByExample(example);
        return claimIncomingViewList;
    }
}
